<?php
     require  'dbcon.php';
     if (isset($_GET['search']))//判断地址栏中没有没search这个参数，有参数
     {
    $search=$_GET['search'];
    $sql="select * from tb_emp where (e_name like '%{$search}%') or (e_dept like '%{$search}%')or (e_gender like '%{$search}%') order by e_id  desc";//按关键字进行搜索 
     }
else//没搜索的参数
     {
    $search="";
    $sql="select * from tb_emp order by e_id  desc ";//查全部  
     };
     $result=$db->query($sql);
     $bbsdata=$result->fetch_all(MYSQLI_ASSOC);
     $result->free_result();
     $db->close();//关闭数据库连接
     require "list_html.php";

